home *** CD-ROM | disk | FTP | other *** search
/ Super PC 35 / Super PC 35 (Shareware).iso / spc / WIN95 / CM95 / INTERNET.DLL / TEXT / WILNETSCAPE < prev    next >
Encoding:
Text File  |  1996-03-20  |  2.0 KB  |  105 lines

  1. bOK = @TRUE
  2. szDial     = "<dialupname>"
  3. szPgmPath  = "<pgmpath>"
  4. szPgmDir   = "<pgmdir>"
  5. bSendMail  = <sendmail>
  6. bEmpty     = <empty>
  7. szErrDesc  = ""
  8. nWait      = 5 ; How many minutes to wait for Netscape to finish its work
  9.  
  10.  
  11. ;Dial our host (unless user is on a direct connect)...
  12. hConn = 0
  13. if (szDial <> "")
  14.     hConn = SDialUp (szDial)
  15.     nErr = SGetLastErr ()
  16.     if (!hConn)
  17.         switch nErr
  18.             case @SErrNotFound
  19.             szErrDesc = "Couldn't connect to %szDial% - no such dial-up"
  20.  
  21.             case nErr ; <--default
  22.             szErrDesc = "Couldn't connect to %szDial% - error %nErr%"
  23.         endswitch
  24.         bOK = @FALSE
  25.         goto LogIt
  26.     else
  27.         if (nErr == @SAlready)
  28.             hConn = 0
  29.         endif
  30.     endif
  31. endif
  32.  
  33.  
  34. ; Run Netscape & make it do things...
  35. szTitle = "Netscape"
  36. if (WinExist (szTitle))
  37.     WinActivate (szTitle)
  38. else
  39.     DirChange (szPgmDir)
  40.     Run (szPgmPath, "")
  41.     delay (2)
  42. endif
  43.  
  44.  
  45. ; Bring up the Mail window (which automatically gets new mail too)...
  46. SendKeysTo (szTitle, "!wm")
  47. Delay (10)
  48.  
  49.  
  50. if (WinExistChild(szTitle, "No new messages"))
  51.     SendKey ("~")
  52. endif
  53.  
  54. if (WinExist("Password Entry Dialog"))
  55.     WinClose ("Password Entry Dialog")
  56. endif
  57.  
  58.  
  59. ; Send outgoing mail/articles (if chosen)...
  60. if (bSendMail)
  61.     if (WinExist (szTitle))
  62.         SendKeysTo (szTitle, "!fd")
  63.     endif
  64. endif
  65.  
  66.  
  67. ; Wait for nWait minutes, or till user kills off Netscape manually...
  68. for n=1 to nWait * 6
  69.     if (WinExist (szTitle))
  70.         Delay (10)
  71.     endif
  72. next n
  73.  
  74.  
  75. ; If user hit Ctrl+Break, WIL will bring us here...
  76. :Cancel
  77.  
  78. ; Hang up...
  79. :HangUp
  80. if (hConn)
  81.     nRet = SHangUp (hConn)
  82. endif
  83.  
  84.  
  85. ; Empty the trash (if chosen)...
  86. if (bEmpty)
  87.     if (WinExist (szTitle))
  88.         SendKeysTo (szTitle, "!fe")
  89.     endif
  90. endif
  91.  
  92.  
  93. ; Log what we did...
  94. :LogIt
  95. if bOK == @TRUE
  96.     szLog = "Ran Netscape"
  97. else
  98.     szLog = strcat ("Error attempting to automate Netscape:", @CRLF, szErrDesc)
  99. endif
  100.  
  101. CMLogMessage (szLog)
  102. exit
  103.  
  104. ~
  105.